package com.api.shopapi.service.impl;

import com.api.shopapi.entity.Seats;
import com.api.shopapi.entity.dto.SeatsDTO;
import com.api.shopapi.mapper.SeatsMapper;
import com.api.shopapi.service.SeatsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("SeatsServiceImplOne")
public class SeatsServiceImpl  implements SeatsService {

    @Autowired
    private SeatsMapper seatsMapper;

    @Override
    public int insert(Seats seats){
        return seatsMapper.insert(seats);
    }



    @Override
    public int update(Seats seats){
        return seatsMapper.update(seats);
    }

    @Override
    public Seats getBySeatsCode(String seatsCode){
        return seatsMapper.getBySeatsCode(seatsCode);
    }

    @Override
    public Seats getByUserCode(String userCode){
        return seatsMapper.getByUserCode(userCode);
    }

    @Override
    public Seats getByStaffCode(String staffCode) {
        return seatsMapper.getByStaffCode(staffCode);
    }

    @Override
    public Seats getByPhone(String phone) {
        return seatsMapper.getByPhone(phone);
    }

    @Override
    public Seats getByGovernmentCode(String governmentCode) {
        return seatsMapper.getByGovernmentCode(governmentCode);
    }


    @Override
    public List<Seats> getList(){
        return seatsMapper.getList();
    }



    @Override
    public PageInfo<SeatsDTO> getPageInfo(int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<SeatsDTO> listSeats = seatsMapper.getListAndGov();
        PageInfo<SeatsDTO> pageInfo = new PageInfo<SeatsDTO>(listSeats);
        return pageInfo;
    }

}
